package com.gmako.service.impl;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.gmako.dao.BaseDAO;
import com.gmako.entity.Packageinfo;
import com.gmako.service.InfoManagerService;
import com.gmako.utils.Pager;
@Service
public class InfoManagerServiceImpl implements InfoManagerService{
	@Autowired
	private BaseDAO baseDAO;
	
	
	/**
	 * 根据条件查询
	 * @param title
	 */
	public Pager findPagerByHql(int pageSize, int pageNo,String title) {
		String sqlCount ="select count(id) from Packageinfo where packageName like '%"+title+"%'";
		String SqlList ="select Packageinfo.PackageName,Packageinfo.id,businessinfo.realName,Packageinfo.price,packageinfo.PackNum,packageinfo.realPrice,packageinfo.PackageMaxPeople,packageinfo.zhekou,packageinfo.startTime,packageinfo.endTime,packageinfo.termEndTime,packageinfo.termStartTime,packageinfo.PackType"+
			" from Packageinfo left join businessinfo on packageinfo.businessInfoId=businessinfo.id "+
            "where Packageinfo.packageName like '%"+title+"%'"+
            "ORDER BY Packageinfo.id desc";
		return baseDAO.findPagerSqlForJoin(pageSize, pageNo, sqlCount, SqlList);
	}
	
	/**
	 * 删除
	 * @param houseInfo
	 */
	public void deleteInfo(Class clazz, Serializable id) {
		baseDAO.deleteById(clazz, id);
	}
}
